package com.listener;
/**
 * 监听器 用于启动tomcat时初始化
 *
 */

import com.admin.service.ITerminalService;
import com.task.UploadOssTask;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class TomcatListener implements ServletContextListener {

    @Autowired
    private ITerminalService terminalService;

    @Autowired
    private UploadOssTask  uploadOssTask;


    @Override
    public void contextInitialized(ServletContextEvent sce) {
        terminalService.offlineAllTerminal();
        try {
          //uploadOssTask.uploadOSS();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
